package designmode.Proxy.dynamicproxy;

import java.lang.reflect.Proxy;

public class Client {
    public static void main(String[] args) {
        IShopping shopping = new Shopping();
        MyHandler handler = new MyHandler(shopping);
        ClassLoader classLoader = shopping.getClass().getClassLoader();
        Class<?>[] interfaces = shopping.getClass().getInterfaces();
        IShopping proxy = (IShopping) Proxy.newProxyInstance(classLoader, interfaces, handler);
        proxy.buy();
    }
}
